<?php
/**
 * Created by PhpStorm.
 * User: liyang
 * Date: 2017/12/6  Time: 下午3:49
 * Description: 处理测评
 */

namespace Service;

class AnswerService extends BaseService
{

    /**
     * 返回总分
     * @param $answerArr
     * @return bool|int
     * @throws \Exception
     */
    public function answerRes($answerArr)
    {

        $evaluation_score = 0;

        foreach ($answerArr as $k => $v) {
            $evaluation_score += $v;
            if (!is_numeric($v)) {
                throw new \Exception("有题目没有选择");
            }
        }

        return $evaluation_score;

    }
}
